wipe
model basic -ndm 2 -ndf 2

# 最小测试：2x2网格 = 4个单元
set nx 2
set ny 2
set Lx 1.0
set Ly 1.0
set dx [expr $Lx / $nx]
set dy [expr $Ly / $ny]

# 创建节点
for {set j 0} {$j <= $ny} {incr j} {
    for {set i 0} {$i <= $nx} {incr i} {
        set nodeTag [expr $i + $j*($nx+1) + 1]
        node $nodeTag [expr $i*$dx] [expr $j*$dy]
    }
}

# 边界条件
for {set i 1} {$i <= [expr $nx+1]} {incr i} {
    fix $i 1 1
}

# 材料
nDMaterial ElasticIsotropic 1 30000 0.2

# 单元
set elemTag 1
for {set j 0} {$j < $ny} {incr j} {
    for {set i 0} {$i < $nx} {incr i} {
        set n1 [expr $i + $j*($nx+1) + 1]
        set n2 [expr $n1 + 1]
        set n3 [expr $n2 + ($nx+1)]
        set n4 [expr $n1 + ($nx+1)]
        element quad $elemTag $n1 $n2 $n3 $n4 1.0 PlaneStrain 1
        incr elemTag
    }
}

# 载荷
pattern Plain 1 Linear {
    load 9 0.0 -10.0
}

# GPU求解器
system GPUSolver
constraints Plain
numberer Plain
test NormDispIncr 1.0e-6 20
algorithm Newton
integrator LoadControl 0.1
analysis Static

puts "开始GPU分析..."
analyze 1
puts "GPU分析完成"
